home *** CD-ROM | disk | FTP | other *** search
/ The Very Best of Atari Inside / The Very Best of Atari Inside 1.iso / mint / mntlb20 / lib / sozobon / setjmp.s < prev    next >
Text File  |  1992-01-12  |  718b  |  31 lines

  1. ; setjmp.s - from the mintlib
  2.  
  3.     .text
  4.     .even
  5.     .globl _setjmp
  6. _setjmp:
  7.     move.l    4(sp),a0        ; address of jmp_buf[]
  8.     move.l    (sp),(a0)        ; save return address
  9.     movem.l    d2-d7/a2-a7,4(a0)    ; save registers d2-d7/a2-a7
  10.     clr.l    d0            ; return value is 0
  11.     rts
  12.  
  13.     .globl _longjmp
  14.     .globl ___mint
  15.  
  16. _longjmp:
  17.     tst.w    ___mint            ; see if MiNT is active
  18.     beq    NOMINT            ; no -- do not call sigreturn
  19.     move.w    #$11a,-(sp)        ; Psigreturn() system call
  20.     trap    #1            ; (ignored if not in a sig handler)
  21.     addq.w    #2,sp
  22. NOMINT:
  23.     move.l    4(sp),a0        ; address of jmp_buf[]
  24.     move.w    8(sp),d0        ; value to return
  25.     bne    L1            ; may not be 0
  26.     move.l    #1,d0
  27. L1:
  28.     movem.l    4(a0),d2-d7/a2-a7    ; restore saved reggies
  29.     move.l    (a0),(sp)        ; and the saved return address
  30.     rts
  31.